package com.cz.fra.service.impl;

import java.util.List;

import com.cz.fra.dao.CommentDao;
import com.cz.fra.dao.EntityNotFoundException;
import com.cz.fra.dao.PersistenceException;
import com.cz.fra.dao.impl.JdbcCommentDao;
import com.cz.fra.entity.Comment;
import com.cz.fra.service.CommentService;
import com.cz.fra.service.ServiceException;

public class CommentServiceImpl implements CommentService {

	CommentDao commentDao = new JdbcCommentDao();
	
	@Override
	public List<Comment> getCommentListByReportID(int reportID)
			throws ServiceException {
		List<Comment> commentList = null;
		try {
			commentList = commentDao.getCommentsByReportID(reportID);
		} catch (EntityNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (PersistenceException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return commentList;
	}

	@Override
	public String addComment(Comment comment) throws ServiceException {
		String result = null;
		try {
			result = commentDao.addComment(comment);
		} catch (EntityNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (PersistenceException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return result;
	}

}
